﻿using System.Collections.Generic;
using System.Data;
using System.Data.Common;

namespace DBCore.DB
{
    public abstract class DAO : IDAO
    {
        public string ConnectString { get; set; }
        public string TableName { get; set; }
        public abstract int Add(DbParam[] modelparam);

        public abstract int AddRange(List<DbParam[]> modelparam);
        public abstract int Update(DbParam[] modelparam, DbParam pk);
        public abstract int DeleteByWhere(SqlParam where);
        public abstract int DeleteByKey(DbParam pk);
        public abstract bool Exists(SqlParam where);
        public abstract int Count(SqlParam where);
        public abstract DataSet GetDataSet(int topn, string columns, SqlParam where, string ordreby);
        public abstract DataSet GetDataSetByGroup(int topn, string columns, SqlParam where, string ordreby,string groupby);
        public abstract DataSet GetJoinDataSet(int topn, string columns, SqlParam where, string orderby, string JoinTableName, string on);
        public abstract KeyValuePair<DataSet, int> GetPageDateSet(int page, int pagesize, SqlParam where, string columns, string ordreby, string pk);
        public abstract KeyValuePair<DataSet, int> GetJoinPageDateSet(int page, int pagesize, string columns, SqlParam where, string ordreby, string tablename, string on);

        public abstract string GetDetail(DbParam db);
        public DAO()
        {
        }
    }
}
